using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using UnityEngine;

public class MD5Generator
{
    public static string GetMD5HashFromFile(string filePath)
    {
        using (var md5 = MD5.Create())
        {
            using (var stream = File.OpenRead(filePath))
            {
                byte[] hash = md5.ComputeHash(stream);
                return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();//BitConverter.ToString(hash)转换为 16进制+“-”的形式
            }
        }
    }
}


